package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.tenant.OpenTenantRelationSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerTenantRelationAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.tenant.InviterInfo;
import com.wlyuan.open.scanner.repository.ShareCompanyRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.TENANT_RELATION)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerTenantRelationHandler extends BaseScannerHandler<InviterInfo, OpenTenantRelationSyncDTO> {
    private final ShareCompanyRepository shareCompanyRepository;

    @Override
    protected List<InviterInfo> select() {
        return shareCompanyRepository.getInviter();
    }

    @Override
    protected List<OpenTenantRelationSyncDTO> assembler(List<InviterInfo> data) {
        return ScannerTenantRelationAssembler.assemble(data);
    }

}
